Skip to content

Correctly handle generated array columns #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

andrewtimberlake
Copy link
Contributor

Currently,

alter table(:my_table) do
  add :generated_array, {:array, :text}, generated: "always as (existing_array::text[]) stored"
end

produces

ALTER TABLE "my_table" ADD COLUMN "generated_array" text GENERATED always as (existing_array::text[]) stored[]

with the [] after the GENERATED statement instead of being part of the type definition.

I’m making the assumption that column_type/2 always returns a two element list (all tests currently pass)

@greg-rychlewski
Copy link
Member

Thank you! Nice catch

@greg-rychlewski greg-rychlewski merged commit 96415e3 into elixir-ecto:master Apr 22, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants